<?php
/**
 * Created by PhpStorm
 * USER MingTingLiang   QQ 915802070
 * Date 2020-12-14-014   15:42
 */


class Books extends ProdLoadTemplate implements IProduct
{
    public function getList()
    {
        return [
            ['product_id' => 1006, 'product_name' => '三国演义'],
            ['product_id' => 1007, 'product_name' => '红楼梦'],
            ['product_id' => 1008, 'product_name' => '姜子牙'],
            ['product_id' => 1009, 'product_name' => '纣王'],
        ];
    }

    public function getChild_OldMethod($params)
    {
        return new class($params[0]) {
            public function __construct()
            {
                $arr = ['product_id' => 1006, 'product_name' => '三国演义'];
                foreach ($arr as $k => $v) {
                    $this->$k = $v;
                }
            }
        };
    }

    public function getChild($params)
    {
        return parent::loadData($params[0], "Books");
    }


    function setClick($id)
    {
        // TODO: Implement setClick() method.
        echo "<br>图书点击量设置";
    }

    function setLog($id)
    {
        // TODO: Implement setLog() method.
        echo "<br>日志点击量设置";
    }
}